package com.vains.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vains.entity.OauthPermission;
import com.vains.mapper.OauthPermissionMapper;
import com.vains.service.IOauthPermissionService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 资源表 服务实现类
 * </p>
 *
 * @author vains
 * @since 2021-03-17
 */
@Service
public class OauthPermissionServiceImpl extends ServiceImpl<OauthPermissionMapper, OauthPermission> implements IOauthPermissionService {

    @Override
    public List<String> findPermissionsByUserId(Long userId) {
        List<String> permissionUrls = baseMapper.selectPermissionsByUserId(userId);
        if (CollectionUtils.isEmpty(permissionUrls)) {
            return Collections.emptyList();
        }
        return permissionUrls;
    }
}
